﻿using SocketLib;
using System;
using System.Collections;
using System.Windows.Forms;
using System.Configuration;
using System.Text;

namespace FormAPP
{
    public partial class Form1 : Form
    {
        UDPserver udp = new UDPserver();
        TCPserver tcp = new TCPserver();
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string IP = ConfigurationManager.AppSettings["IP"].ToString();
            int TCPP = Convert.ToInt32(ConfigurationManager.AppSettings["TCPport"].ToString());
            int UDPP = Convert.ToInt32(ConfigurationManager.AppSettings["UDPport"].ToString());
            udp.Start(IP, UDPP);
            tcp.Start(IP, TCPP);
            button1.Text = "O";
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            udp.close();
            tcp.close();
            udp = null;
            tcp = null;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string str = textBox1.Text;
            button2.Text = RegexHelper.getAttr(str, "dev_Id");

            ArrayList ats = RegexHelper.getAttrs(str, "id");
            for (int i = 0; i < ats.Count; i++)
            {
                label1.Text += i.ToString() + ">" + ats[i];
            }




        }

        private void button3_Click(object sender, EventArgs e)
        {
            button3.Text=Convert.ToString( JPushHelper.JPush("09163a04c34", "已经考勤" , "2017-7-15 11:00已经考勤"));
        }
    }
}
